<%@ Page Language="C#" MasterPageFile="~/Views/Shared/MobileCenterMasterPage.Master" Inherits="System.Web.Mvc.ViewPage<Gadget>" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Web.Script.Serialization" %>
<%@ Import Namespace="EPiServer.Shell" %>
<%@ Import Namespace="EPiServer.Shell.Gadgets" %>
<%@ Import Namespace="EPiServer.Shell.Resources" %>
<%@ Import Namespace="EPiServer.Shell.UI.Views.Dashboard" %>
<%@ Import Namespace="EPiServer.Shell.Web.Mvc.Html" %>
<%@ Import Namespace="EPiServer.Shell.Web.Routing" %>
<asp:Content ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript" src="<%= Paths.ToShellResource("Resources/GetLocalizationResource?typeName=EPiServer.Shell.UI.Views.Dashboard.Resources&amp;culture=en")%>"></script>

    <% foreach (var resource in Model.Definition.ClientResourceDependencies)
       {%>
    <%= resource.ToHtmlResource() %>
    <%
        } 
    %>
</asp:Content>
  
<asp:Content ContentPlaceHolderID="MainContentArea" runat="server" >
    <div style="width: 100%; height: 100%;">
        <div class="epi-gadget" id="gadget_<%= Model.Id %>">
            <div class="epi-gadgetWindow">
          <% if (Model.Definition.Actions.Count != 0)
             { %>
             <ul id="epi-mobilecenter-menu">
            <%foreach (GadgetAction action in Model.Definition.Actions)
              { %>
                                        <li>
                                           <%= Html.ViewLink(action.Text, action.Text, action.ActionName, null)%>
                                        </li>
                                        <%} %></ul>
                                        <% } %>
            
                    <div title="<%= Resources.GadgetLoaderTitleText %>" class="epi-gadgetFeedback">
                        &nbsp;</div>
               
                <div class="epi-gadgetContent">
                    <div class='epi-padding epi-contentGadgetLoader'>
                        <%=Resources.GadgetLoaderTitleText %>
                    </div>
                </div>
       

            <script type="text/javascript">
                 
	        //<![CDATA[
	        (function($) {
	            epi.shell.registerInitFunction(function() {
	            	         
                    epi.gadget.init({
                        id: "<%= Model.Id %>",
                        selector: "#gadget_<%= Model.Id %>",
                        contentUrl: '<%= Url.RouteUrl(new { moduleArea = Model.Definition.Area, controller = Model.Definition.ControllerName, action = Model.Definition.DefaultAction }) %>',
                        widgetParams: {
                            initMethod: '<%= Model.Definition.ClientScriptInitMethod ?? ""%>',
                            routeUrl: '<%= Server.UrlDecode(Url.RouteUrl(new { moduleArea = Model.Definition.Area, controller = Model.Definition.ControllerName, action = "{action}" })) %>',
                            routeParameters: <%= new JavaScriptSerializer().Serialize(new { action = Model.Definition.DefaultAction }) %>,
                            removeText: " ",
                            initMethodErrorText: ""
                        }
                    });
                });
	        } (epiJQuery));
	     
	        //remove delete in contextmenu
	          $('.epi-gadgetHeader h2').text(' ');
	          $('.epi-iconToolbar-delete').parent().html('');

	          
	          
	             //]]>
            </script>

        </div>
    </div>
      </div>
       </asp:Content>

